
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //a==>b==>a
        let map=new Map([["name","唐玮"],["age",20]]);

        //转化为数组
        console.log([...map]);
        console.log([...map.keys()]);//["name","age"]
        console.log([...map.values()]);//['唐玮', 20]
        console.log([...map.entries()]);

        //案例,把名字是唐玮的拿出来
         let newarr=[...map].filter(item=>{
               return item[1]=="唐玮";
         });
         //再转换为map
        
         console.log(new Map(newarr));
    </script>
</body>
</html>